package com.its.employee.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.its.employee.mapper.EmployeeMapper;
import com.its.employee.pojo.Employee;
import com.its.employee.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author lenovo
* @description 针对表【gym_employee】的数据库操作Service实现
* @createDate 2025-04-22 22:30:00
*/
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {
    //依赖注入Mapper层属性
    @Autowired
    private EmployeeMapper employeeMapper;

    //新增员工
    @Override
    public int addEmployeeService(Employee employee) {
        return employeeMapper.insert(employee);
    }

    //删除员工
    @Override
    public int deleteEmployeeService(Integer employeeAccount) {
        return employeeMapper.deleteById(employeeAccount);
    }

    //修改员工信息
    @Override
    public int updateEmployeeService(Employee employee) {
        return employeeMapper.updateById(employee);
    }

    //根据Id查询员工信息
    @Override
    public Employee selectEmployeeByEmployeeAccount(Integer employeeAccount) {
        return employeeMapper.selectById(employeeAccount);
    }

    //分页查询所有员工信息
    @Override
    public Page<Employee> getAllEmployee(Integer page, Integer size) {
        return employeeMapper.selectPage(new Page<>(page,size),null);
    }
}




